package com.bestcem.xm.wallet.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 企业钱包充值订单状态
 *
 * @author wangyunyun <yunyun.wang@idiaoyan.com>
 * @version v1.0
 * @date 2022/5/17 15:11
 */
@Getter
@AllArgsConstructor
public enum WalletRechargeOrderStatusEnum {

    /**
     * 企业钱包充值订单状态
     */
    UNSPECIFIED(0, "未指定", null),
    CREATED(1, "订单已创建", null),
    COMPLETED(2, "订单已完成", LimitOrderStatusEnum.FINISHED.getStatus()),
    CANCELED(3, "订单已取消", LimitOrderStatusEnum.CANCELLED.getStatus()),
    ;

    private Integer status;

    private String desc;

    private Integer limitOrderStatus;

    /**
     * 通状态获取枚举
     *
     * @param value 状态
     * @return WalletRechargeOrderStatusEnum
     * @author wangyunyun <yunyun.wang@idiaoyan.com>
     * @date 2022/5/17 15:11
     */
    public static WalletRechargeOrderStatusEnum getByStatus(Integer value) {
        if (value == null) {
            return null;
        }
        return Stream.of(values()).filter(t -> t.getStatus().equals(value)).findFirst().orElse(null);
    }

}
